package com.firesrc.mail.search;

import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

public class SearchMail114LaImpl extends AbstractSearchMail implements SearchMailStrategy {

	@Override
	public Set getMailListFromUrl(String url) {

		try {
			if (url.startsWith("www.")) {
				url = url.substring(4);
			}
			Document doc = Jsoup.connect("http://tool.114la.com/whois/" + url).userAgent("test")
					.cookie("auth", "token").timeout(10000).get();
			String text = doc.text();
			return getMailListFromText(text);
		} catch (IOException e) {
			System.out.println("连接网站错误:" + url);
			System.err.println(e.getMessage());
		}
		return new HashSet<String>();

	}

}
